UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BMqmmGKeH/nZ0d21lp9YL+2NSQY78rMMajVi5b0Mvmw=' 
WHERE 
  key_id = '45d7c7006b415d8ab47da45e6b22829d1b09753f41d8683170d2062f1501e79b' 
  AND (
    token = 'BMqmmGKeH/nZ0d21lp9YL+2NSQY78rMMajVi5b0Mvmw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047