UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mFOc9Iv4crUMk8O2fkJEF7DVfG4yV8aD8Jd596QApf8='
WHERE
key_id = 'ed3cf2ee8157528c4ffb7b45ec6ae6dd891e6690a7bd63d26ae926bf369ea8be'
AND (
token = 'mFOc9Iv4crUMk8O2fkJEF7DVfG4yV8aD8Jd596QApf8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)