UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mDMSQwFL9MRMdSlAllPeypDFqGsOBmFEJ7t4P3/iqCI=' 
WHERE 
  key_id = '127422dd41faf107f8cf01e6bf947af6cf2be144edd4b2ac362fb50680761f0a' 
  AND (
    token = 'mDMSQwFL9MRMdSlAllPeypDFqGsOBmFEJ7t4P3/iqCI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040