UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jjBbooj2D3MHjI6zbGpw/OdQnOBO3sEXpTxK80pFIC0='
WHERE
key_id = 'd487d40471994b005622ca67d0ff699771fd2305b036a8ec439eb7eedf515b42'
AND (
token = 'jjBbooj2D3MHjI6zbGpw/OdQnOBO3sEXpTxK80pFIC0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)