UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q9R83hzMAjGVr+k0wPj2Hjry+Q93gq7UKFw6eoF/+dw=' 
WHERE 
  key_id = '676ed44a7d2ccde5931952c31e1a959da9067681d4d96be20e8ba1564189d804' 
  AND (
    token = 'Q9R83hzMAjGVr+k0wPj2Hjry+Q93gq7UKFw6eoF/+dw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00067