UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+HMynDHWtDW6Hou01xTeV6yhB5yCqf3OzdOchwAU8Gw='
WHERE
key_id = '0a0f400a9c1ad74e0f4864b03fb762867e1672c4562551ef9227c470d7a78e4b'
AND (
token = '+HMynDHWtDW6Hou01xTeV6yhB5yCqf3OzdOchwAU8Gw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)