UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3BeYrDCcxv3xJoYhxxdT1lxS8RMaeKA0mTS16fJiszg='
WHERE
key_id = 'a027e88dd293a75354353a0366759b915b1fd556ee8626d6958fb6b249048795'
AND (
token = '3BeYrDCcxv3xJoYhxxdT1lxS8RMaeKA0mTS16fJiszg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)