UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M52XrR0WX0cxSlgAWlclVGtXOAG0lWieqLwr4vFo/7k=' 
WHERE 
  key_id = '462bc363fd5bceed3436169be32c1b4b10bf943b87da48f9c7b95f1d7978eacf' 
  AND (
    token = 'M52XrR0WX0cxSlgAWlclVGtXOAG0lWieqLwr4vFo/7k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054