UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SgXr8sLzDjC3LpHF1zFw0UMyUd+Q3vQp9shdHIIcOyY='
WHERE
key_id = 'e3c03c44ce6ff8f5ef077d154527e0cb6a81df807a4de222360b82aef75a790d'
AND (
token = 'SgXr8sLzDjC3LpHF1zFw0UMyUd+Q3vQp9shdHIIcOyY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)