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