UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XD9Dhz/9kialIOHUfLWitOrJHCTKdV8sKZ4cbOfa40Q=' 
WHERE 
  key_id = 'b68cbb19170ac1cf8d7388ff772ba62cf0e978c51aebc02d3c43fb301c046118' 
  AND (
    token = 'XD9Dhz/9kialIOHUfLWitOrJHCTKdV8sKZ4cbOfa40Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016