UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cqfKuxacyXq98cV7f3Dj+Gie7Dwr7iCrx22j+c45ys8=' 
WHERE 
  key_id = 'b296c093ba8c1f1c08f2d317656c2297705eaa90753c1a019ae2feb11b83267f' 
  AND (
    token = 'cqfKuxacyXq98cV7f3Dj+Gie7Dwr7iCrx22j+c45ys8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025