UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '04nsRvrDgcMMq0cAZYJf+ik2axZG36PaPROd+Id0n/U=' 
WHERE 
  key_id = '55d5ab20761ce7c8b7fc333330c4acc92777e8be7693639350a7eb348eb41f01' 
  AND (
    token = '04nsRvrDgcMMq0cAZYJf+ik2axZG36PaPROd+Id0n/U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036