UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KBxuniuQd7R9R/RIUjYm94F+GAHM6z+/1Pk7cpYYVuk='
WHERE
key_id = 'f144d3d2470961acfd429e6ee8f55d88ef4323e1892ef51f6e2e33504ae3c3d7'
AND (
token = 'KBxuniuQd7R9R/RIUjYm94F+GAHM6z+/1Pk7cpYYVuk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)