UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bjv4PZ7dbdQI1h1lJozU0weLLB6t7e0m59Zx8a5Dewg=' 
WHERE 
  key_id = '044408a48527b884424473d714933a2685e5d4733d2245a93a7455fa6d24caf2' 
  AND (
    token = 'Bjv4PZ7dbdQI1h1lJozU0weLLB6t7e0m59Zx8a5Dewg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024