UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dwoSU+Ksi5lTWpOMTiCtAly/n1z+32HMGPEbUCg2sRU='
WHERE
key_id = 'bfc114794399b81ec8e07a31b443db24585dd8a35eafa14817d5b9275066ef0c'
AND (
token = 'dwoSU+Ksi5lTWpOMTiCtAly/n1z+32HMGPEbUCg2sRU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)