UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Jy2Ut4BBaOfE3Qq5nnVIDJMN33n3zpmulolotCS2jkc='
WHERE
key_id = 'e8bc720154da4a085517e4baa8aab417ad5a5e0dc14de0154b05074a899ea623'
AND (
token = 'Jy2Ut4BBaOfE3Qq5nnVIDJMN33n3zpmulolotCS2jkc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)