UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8RM5fXVGWXNgmrTmrSX7o7kjRs6CxsgDq1hIydPHlQs='
WHERE
key_id = 'c3f1f69bd6637c1f98fac3bcff2c6ace0efd6792a087a8b667566c62c5a327f1'
AND (
token = '8RM5fXVGWXNgmrTmrSX7o7kjRs6CxsgDq1hIydPHlQs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)