UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wYnnv+QmpwkBR2EfTsBH9BB0iwT7pHIvWwlTGO61B38='
WHERE
key_id = 'a5e9af882b5db5ce778841ab5cbbc79a4e02cf40a393b5aefe14f0c5f96e9bcf'
AND (
token = 'wYnnv+QmpwkBR2EfTsBH9BB0iwT7pHIvWwlTGO61B38='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)