UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'THcew1zCGVKdvZROZrD67VdFOH/NeCa/WsxgNs+iiw4=' 
WHERE 
  key_id = 'a5e0489df019c71c20d14b849de9ec2c4b955189a00c725920045465c7ecb053' 
  AND (
    token = 'THcew1zCGVKdvZROZrD67VdFOH/NeCa/WsxgNs+iiw4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027