UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EYlOpWMLAd7cPwjmNfydACFwpDnwb+HIKCnrqXgQX7I='
WHERE
key_id = 'e4313f9d92e8565cc8d99e7ba7464ed62dd985d71cb8866860b3ce79f32c833d'
AND (
token = 'EYlOpWMLAd7cPwjmNfydACFwpDnwb+HIKCnrqXgQX7I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)