UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q0eJHNcyXPhfdq1e+s+Ax4E/GtgIa5/zA32x/q0Wf6Y='
WHERE
key_id = 'e5910e69ade8220b1591d6aba3326f32191add24b78153e450e4edc562b79acc'
AND (
token = 'q0eJHNcyXPhfdq1e+s+Ax4E/GtgIa5/zA32x/q0Wf6Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)