UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aM4VtULkXLmOg9q1KaB+6OP8kbd6fe9AwQ3/PFW5g/0=' 
WHERE 
  key_id = 'b8e172c3a94223a7adbb39737d86022c897d646e3bda2849887831606506e6b3' 
  AND (
    token = 'aM4VtULkXLmOg9q1KaB+6OP8kbd6fe9AwQ3/PFW5g/0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047