UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a7aILNC2pDimcIsvSR5sSJOrU+yr5YEjKZvh3ri4oVA='
WHERE
key_id = '6b54d428bdf766df7f0a35637e1421b51415886244fccbf0e208823577bd70f2'
AND (
token = 'a7aILNC2pDimcIsvSR5sSJOrU+yr5YEjKZvh3ri4oVA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)