UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wE+qzGlC5H2wuie+0fo10DrbVivpmKiONuhsSNIQcJg=' 
WHERE 
  key_id = 'a506bb60d6571c7f18f9ffaba5a1a89392565aca47478e81acc23d09ecc4b3f7' 
  AND (
    token = 'wE+qzGlC5H2wuie+0fo10DrbVivpmKiONuhsSNIQcJg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060