UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'grIZgS0hxQ6XzxZG24jBKxfAXFcuj1wCHKORzlmdy2Y='
WHERE
key_id = '7b5f814146c373d664c28b9ab4e3c211b71e6a368499ca4f6459876058ec65a4'
AND (
token = 'grIZgS0hxQ6XzxZG24jBKxfAXFcuj1wCHKORzlmdy2Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)