UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iYB9vW6DqubDJPcsiKizkyqLLvmNopfZv3xMIPkWGC4=' 
WHERE 
  key_id = '874b3e12f3929c51f01e8b3214ebafb896719749e65cfcab262a9b9305bdf215' 
  AND (
    token = 'iYB9vW6DqubDJPcsiKizkyqLLvmNopfZv3xMIPkWGC4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035