UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fgAR1yEWzuXnoZrNOBI9axCJlpZKtPdljcnq4aqoTGk='
WHERE
key_id = '57bb93e38af1dd513da9524d2f9c1d274064f0af9baa8c7f5fb5dc43687d5616'
AND (
token = 'fgAR1yEWzuXnoZrNOBI9axCJlpZKtPdljcnq4aqoTGk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)