UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qlMr6FBQxPuFEafOlBkqk49aMkosldw4YCQCuOrocMg=' 
WHERE 
  key_id = 'c3c7cc875718aa852a7b3d89cc52b299dd328fe5ad00fd6213b1fbca20ea8647' 
  AND (
    token = 'qlMr6FBQxPuFEafOlBkqk49aMkosldw4YCQCuOrocMg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035